{% extends "templates/base.html" %}

{% block title%}Create Ride Offer{% endblock %}

{% block main %}
	<h2>Create Ride Offer</h2>

	<form method="post">
		
		{{ rideoffer_form.non_field_errors }}
		
		<div class="inputgroup">
			<div>
				{% if show_source_favorites %}
					{{ rideoffer_form.source.label_tag }}
					{{ rideoffer_form.source }}
				{% else %}
					{{ rideoffer_form.source_address.label_tag }}
					{{ rideoffer_form.source_address }}
					
					{% if current_user.locations.count %}
						<a class="buttonlink" href="/rideoffer_create?showSourceFavorites=True&amp;showDestinationFavorites={{ show_destination_favorites  }}">Favorites</a>
					{% endif %}
				{% endif %}
			</div>
		
			<div>
				{% if show_destination_favorites %}
					{{ rideoffer_form.destination.label_tag }}
					{{ rideoffer_form.destination }}
				{% else %}
					{{ rideoffer_form.destination_address.label_tag }}
					{{ rideoffer_form.destination_address }}
					
					{% if current_user.locations.count %}
						<a class="buttonlink" href="/rideoffer_create?showSourceFavorites={{ show_source_favorites }}&amp;showDestinationFavorites=True">Favorites</a>
					{% endif %}
				{% endif %}
			</div>
		</div>
	
		<div class="inputgroup">
			<div>
				{{ rideoffer_form.date.label_tag }}
				{{ rideoffer_form.date }}
			</div>
		
			<div>
				{{ rideoffer_form.departure_time.label_tag }}
				{{ rideoffer_form.departure_time }}
			</div>
		
			<div>
				{{ rideoffer_form.arrival_time.label_tag }}
				{{ rideoffer_form.arrival_time }}
			</div>
		</div>
		
		<div class="inputgroup">
			<div>
				{{ rideoffer_form.number_of_seats.errors }}
				{{ rideoffer_form.number_of_seats.label_tag }}
				{{ rideoffer_form.number_of_seats }}
			</div>
		
    		<div>
				<strong>{{ rideoffer_form.notes.label }}</strong>
				{{ rideoffer_form.notes }}
			</div>
		</div>

	<p>
		<input type="hidden" name="_do_create_rideoffer" value="True">
		<input class="button" type="submit" value="Create"/>
	</p>
	</form>
{% endblock %}